package com.sky.loveshop.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @author xcy
 * @version V1.0
 * @description
 * @date 2024/8/18 0:07
 */
@Data
@Table(name = "product")
public class Product {

    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @NotBlank(message = "商品名称不能为空")
    @Column(name = "name")
    private String name;

    @Column(name = "description")
    private String description;

    @NotBlank(message = "商品图片不能为空")
    @Column(name = "picture")
    private String picture;

    @NotNull(message = "商品分类不能为空")
    @Column(name = "category_id")
    private Integer categoryId;

    @Column(name = "bar_code")
    private String barCode;

    @Column(name = "upc_code")
    private String upcCode;

    @Column(name = "buy_price")
    private Long buyPrice;

    @Column(name = "suggest_sell_price")
    private BigDecimal suggestSellPrice;

    @Column(name = "stock_number")
    private Integer stockNumber;

    @Column(name = "brand")
    private String brand;

    @Column(name = "supplier")
    private String supplier;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "up_time")
    private Date upTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "down_time")
    private Date downTime;

    @Column(name = "product_no")
    private String productNo;

    @Column(name = "unit")
    private String unit;

    @Column(name = "shelf_name")
    private String shelfName;

}
